//
//  MyCouponsViewController.m
//  AnXin100
//
//  Created by Sakura on 2018/11/5.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "MyCouponsViewController.h"
#import "XXPageTabView.h"
#import "CouponsTypeViewController.h"
@interface MyCouponsViewController ()
@property (nonatomic, strong) XXPageTabView *pageTabView;
@end

@implementation MyCouponsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.pageTabView];
}

- (XXPageTabView *)pageTabView
{
    if (!_pageTabView) {
        

        
        for (NSInteger i = 0; i < 3; i++) {
            CouponsTypeViewController *vc = [CouponsTypeViewController new];
            vc.i = i;
            [self addChildViewController:vc];
        }
        
        //支持网易云音乐，今日头条，微博等切换栏效果
        _pageTabView = [[XXPageTabView alloc] initWithChildControllers:self.childViewControllers childTitles:@[@"待使用", @"已使用", @"已过期"]];
        _pageTabView.frame = CGRectMake(0, Hn, Wi, Hi-Hn);
        
        _pageTabView.selectedTabIndex = 0;
        _pageTabView.maxNumberOfPageItems = 5;
        _pageTabView.tabSize = CGSizeMake(Wi, 44);
        _pageTabView.tabItemFont = FONT_FOURTEEN;
        /** 适配 */
        if (SCREEN_WIDTH <= 375) {
            
            _pageTabView.tabItemFont = FONT_TWELVE;
        }
        
        _pageTabView.unSelectedColor = White(50);
        _pageTabView.selectedColor = COLOR_GREEN;
        
        _pageTabView.tabBackgroundColor = White(250);
        
        //_pageTabView.separatorColor = [[UIColor grayColor] colorWithAlphaComponent:0.4];
        _pageTabView.bodyBounces = NO;
        
        _pageTabView.indicatorWidth = 0;
        _pageTabView.indicatorHeight = 2;
        
        _pageTabView.delegate = self;
        _pageTabView.titleStyle = XXPageTabTitleStyleDefault;
        _pageTabView.indicatorStyle = XXPageTabIndicatorStyleDefault;
        
        UIScrollView *bodyView = [_pageTabView valueForKey:@"bodyView"];
        [bodyView.panGestureRecognizer requireGestureRecognizerToFail:self.navigationController.interactivePopGestureRecognizer];
    }
    return _pageTabView;
}




@end
